﻿@model MMPS.Entity.ViewModel.UserListViewModel

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>add</title>
    @*引入包*@
    <link href="~/Content/Easy UI/themes/icon.css" rel="stylesheet" />
    <link href="~/Content/Easy UI/themes/default/easyui.css" rel="stylesheet" />
    <script src="~/Content/Easy UI/script/jquery-1.11.1.js"></script>
    <script src="~/Content/Easy UI/script/jquery.easyui.min.js"></script>
    <script src="~/Content/Easy UI/script/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#btn").click(function () { //添加提交的时候，获取url
                var url = "/UserInfo/add";
                //判断id是否存在，如果存在跳转的修改
                var U_ID = $("#U_ID").val();
                if (parseInt(U_ID) > 0) {
                    url = "/UserInfo/Edit";
                }
                //获取页面文本框信息,给form添加id
                var FormData = $("#Form_User").serializeArray();
                $.post(url, FormData, function (data) {
                    if (data.ResultStatus == 1) {  //弹出框
                        window.parent.$.messager.alert("温馨提示", data.Msg, "info");
                        //关闭窗口
                        window.parent.$("#dlg").dialog("close");
                        //刷新页面
                        window.parent.$("#UserTable").datagrid("reload");
                    } else {
                        window.parent.$.messager.alert("温馨提示", data.Msg, "error");
                    }
                  

                })

            });
           

        })

    </script>
</head>
<body>
    @using (Html.BeginForm("","",FormMethod.Post,new { id="Form_User"}))
    {
        <fieldset>
            <legend>新增员工信息</legend>

            <table>
                <tr>
                    <td>登录名：</td>
                    <td>@Html.EditorFor(model => model.U_LoginName, new { htmlAttributes = new { @class = "form-control" } })</td>
                </tr>

                <tr>
                    <td>真实姓名</td>
                    <td>@Html.EditorFor(model => model.U_RealName, new { htmlAttributes = new { @class = "form-control" } })</td>
                </tr>

                <tr>
                    <td>性别</td>

                    <td>
                        @Html.EditorFor(model => model.U_Sex, new { htmlAttributes = new { @class = "form-control" } })
                        @*@Html.RadioButtonFor(model => model.U_Sex, new { htmlAttributes = new { @class = "form-control" } })  男
                        @Html.RadioButtonFor(model => model.U_Sex, new { htmlAttributes = new { @class = "form-control" } }) 女*@
                    </td>
                </tr>


                <tr>
                    <td>联系电话</td>
                    <td>@Html.EditorFor(model => model.U_Telephone, new { htmlAttributes = new { @class = "form-control" } })</td>
                </tr>

                <tr>
                    <td>角色</td>
                    <td>
                        @*@Html.DropDownList("U_Role", ViewBag.U_Role as IEnumerable<SelectListItem>, new { htmlAttributes = new { @class = "form-control" } })*@
                        @Html.EnumDropDownListFor(model => model.U_Role, "请选择")
                    </td>
                </tr>


                <tr>
                    <td>是否可以删除</td>
                    <td>
                        @Html.EditorFor(model => model.U_CanDelete, new { htmlAttributes = new { @class = "form-control" } })
                    </td>
            </tr>

            <tr>
                <td></td>
                <td><input type="button" value="提交" class="btn btn-default" id="btn" /></td>
            </tr>
        </table>
        @Html.HiddenFor(model => model.U_ID)
    </fieldset>
}

</body>
</html>
